.TH std::generator::iterator 3 "2024.06.10" "http://cppreference.com" "C++ Standard Libary"
.SH NAME
std::generator::iterator \- std::generator::iterator

.SH Synopsis
   class /*iterator*/;  (since C++23)
                        (exposition only*)

   The return type of generator::begin.

   Models indirectly_readable and input_iterator.

.SH Member types

   Member type     Definition
   value_type      std::generator::value
   difference_type std::ptrdiff_t

   Data members

   Member name  Definition
   coroutine_   A coroutine handle of type
   (private)    std::coroutine_handle<std::generator::promise_type>.
                (exposition-only member object*)

.SH Member functions

   constructor     constructs an iterator
                   \fI(public member function)\fP
   operator=       assigns another iterator
                   \fI(public member function)\fP
   operator*       returns an underlying value
                   \fI(public member function)\fP
   operator++      advances the iterator
   operator++(int) \fI(public member function)\fP

std::generator::iterator::iterator

   /*iterator*/( /*iterator*/&& other ) noexcept;  (since C++23)

   Initializes coroutine_ with std::exchange(other.coroutine_, {});.

std::generator::iterator::operator=

   /*iterator*/& operator=( /*iterator*/&& other ) noexcept;  (since C++23)

   Equivalent to coroutine_ = std::exchange(other.coroutine_, {});.

   Returns: *this.

std::generator::iterator::operator*

   reference operator*() const                                       (since C++23)
       noexcept( std::is_nothrow_copy_constructible_v<reference> );

    1. Let reference be the std::generator's underlying type.
    2. Let for some generator object x its coroutine_ be in the stack *x.active_.
    3. Let x.active_->top() refer to a suspended coroutine with promise object p.

   Equivalent to return static_cast<reference>(*p.value_);.

std::generator::iterator::operator++

   constexpr /*iterator*/& operator++(); \fB(1)\fP (since C++23)
   constexpr void operator++( int );     \fB(2)\fP (since C++23)

   1) Let for some generator object x the coroutine_ be in the stack *x.active_.
   Equivalent to x.active_->top().resume().
   Returns: *this.
   2) Equivalent to ++*this;.

.SH Non-member functions

   operator== compares the underlying iterator with a sentinel
   (C++23)    \fI(function)\fP

operator==(std::generator::iterator)

   friend bool operator==( const /*iterator*/& i,                         (since C++23)
   std::default_sentinel_t );

   Equivalent to return i.coroutine_.done();.

   The != operator is synthesized from operator==.

   This function is not visible to ordinary unqualified or qualified lookup, and can
   only be found by argument-dependent lookup when std::generator::iterator is an
   associated class of the arguments.

.SH Example

    This section is incomplete
    Reason: no example

.SH Category:
     * Todo no example
